//
//  MonsterConfig.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/7/26.
//
//

#include "MonsterConfig.h"

#define    DEF_HP       (9999)
#define    BASE_HP_1    (30)
#define    HP_GAP_1     (20)
#define    BASE_HP_2    (150)
#define    HP_GAP_2     (30)
#define    BASE_HP_3    (300)
#define    HP_GAP_3     (40)
#define    BASE_HP_4    (700)
#define    HP_GAP_4     (50)
#define    BASE_HP_5    (1200)
#define    HP_GAP_5     (60)
#define    BASE_HP_6    (2100)
#define    HP_GAP_6     (70)


int MonsterConfig::getMonsterHp(int type)
{
    switch (type) {
        case MonsterType01: return BASE_HP_1+HP_GAP_1*type;
        case MonsterType02: return BASE_HP_1+HP_GAP_1*type;
        case MonsterType03: return BASE_HP_1+HP_GAP_1*type;
        case MonsterType04: return BASE_HP_1+HP_GAP_1*type;
        case MonsterType05: return BASE_HP_1+HP_GAP_1*type;
        case MonsterType06: return BASE_HP_2+HP_GAP_2*(type-5);
        case MonsterType07: return BASE_HP_2+HP_GAP_2*(type-5);
        case MonsterType08: return BASE_HP_2+HP_GAP_2*(type-5);
        case MonsterType09: return BASE_HP_2+HP_GAP_2*(type-5);
        case MonsterType10: return BASE_HP_2+HP_GAP_2*(type-5);
        case MonsterType11: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType12: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType13: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType14: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType15: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType16: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType17: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType18: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType19: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType20: return BASE_HP_3+HP_GAP_3*(type-10);
        case MonsterType21: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType22: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType23: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType24: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType25: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType26: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType27: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType28: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType29: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType30: return BASE_HP_4+HP_GAP_4*(type-20);
        case MonsterType31: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType32: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType33: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType34: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType35: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType36: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType37: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType38: return BASE_HP_5+HP_GAP_5*(type-30);
        case MonsterType39: return 300;
        case MonsterType40: return 300;
        case MonsterType41: return 300;
        case MonsterType42: return 400;
        case MonsterType43: return 400;
        case MonsterType44: return 400;
        case MonsterType45: return 500;

        case MonsterType46:
        case MonsterType47:
        case MonsterType48:
        case MonsterType49:
        case MonsterType50: return BASE_HP_6+HP_GAP_6*(type-45);
        case MonsterType51: return 400;
        case MonsterType52:
        case MonsterType53:
        case MonsterType54:
        case MonsterType55:
        case MonsterType56:
        case MonsterType57:
        case MonsterType58:
        case MonsterType59:
        case MonsterType60: return BASE_HP_6+HP_GAP_6*(type-45);
        case MonsterType61: return 300;
        case MonsterType62:
        case MonsterType63:
        case MonsterType64:
        case MonsterType65:
        case MonsterType66:
        case MonsterType67:
        case MonsterType68: return BASE_HP_6+HP_GAP_6*(type-45);
        case MonsterType69: return 500;
        case MonsterType70: return BASE_HP_6+HP_GAP_6*(type-45);
            
    }
    return DEF_HP;
}

bool MonsterConfig::isBoss(int type)
{
    switch (type) {
        case MonsterType38: return true;
        default:
            return false;
    }
}

int MonsterConfig::getSwordProperty(int type)
{
    switch (type) {
        case MonsterType05: return MonsterPropertyTypeWeak;
        case MonsterType11: return MonsterPropertyTypeImmune;
        case MonsterType22: return MonsterPropertyTypeWeak;
        case MonsterType38: return MonsterPropertyTypeImmune;
        case MonsterType39: return MonsterPropertyTypeImmune;
        case MonsterType40: return MonsterPropertyTypeImmune;
        case MonsterType41: return MonsterPropertyTypeImmune;
        case MonsterType42: return MonsterPropertyTypeImmune;
        case MonsterType43: return MonsterPropertyTypeImmune;
        case MonsterType44: return MonsterPropertyTypeImmune;
        case MonsterType45: return MonsterPropertyTypeImmune;
        case MonsterType51: return MonsterPropertyTypeImmune;
        case MonsterType61: return MonsterPropertyTypeImmune;
        case MonsterType69: return MonsterPropertyTypeImmune;
        default:
            return MonsterPropertyTypeNone;
    }
}

int MonsterConfig::getArrowProperty(int type)
{
    switch (type) {
        case MonsterType04: return MonsterPropertyTypeWeak;
        case MonsterType12: return MonsterPropertyTypeImmune;
        case MonsterType15: return MonsterPropertyTypeImmune;
        case MonsterType24: return MonsterPropertyTypeWeak;
        case MonsterType30: return MonsterPropertyTypeImmune;
        case MonsterType39: return MonsterPropertyTypeImmune;
        case MonsterType40: return MonsterPropertyTypeImmune;
        case MonsterType41: return MonsterPropertyTypeImmune;
        case MonsterType42: return MonsterPropertyTypeImmune;
        case MonsterType43: return MonsterPropertyTypeImmune;
        case MonsterType44: return MonsterPropertyTypeImmune;
        case MonsterType45: return MonsterPropertyTypeImmune;
        case MonsterType51: return MonsterPropertyTypeImmune;
        case MonsterType61: return MonsterPropertyTypeImmune;
        case MonsterType69: return MonsterPropertyTypeImmune;
        default:
            return MonsterPropertyTypeNone;
    }
}

int MonsterConfig::getFireProperty(int type)
{
    switch (type) {
        case MonsterType03: return MonsterPropertyTypeWeak;
        case MonsterType07: return MonsterPropertyTypeWeak;
        case MonsterType13: return MonsterPropertyTypeImmune;
        case MonsterType14: return MonsterPropertyTypeWeak;
        case MonsterType15: return MonsterPropertyTypeWeak;
        case MonsterType20: return MonsterPropertyTypeWeak;
        case MonsterType26: return MonsterPropertyTypeWeak;
        case MonsterType39: return MonsterPropertyTypeImmune;
        case MonsterType40: return MonsterPropertyTypeImmune;
        case MonsterType41: return MonsterPropertyTypeImmune;
        case MonsterType42: return MonsterPropertyTypeImmune;
        case MonsterType43: return MonsterPropertyTypeImmune;
        case MonsterType44: return MonsterPropertyTypeImmune;
        case MonsterType45: return MonsterPropertyTypeImmune;
        case MonsterType51: return MonsterPropertyTypeImmune;
        case MonsterType61: return MonsterPropertyTypeImmune;
        case MonsterType69: return MonsterPropertyTypeImmune;
            
        default:
            return MonsterPropertyTypeNone;
    }
}

int MonsterConfig::getLightProperty(int type)
{
    switch (type) {
        case MonsterType06: return MonsterPropertyTypeWeak;
        case MonsterType08: return MonsterPropertyTypeWeak;
        case MonsterType14: return MonsterPropertyTypeImmune;
        case MonsterType18: return MonsterPropertyTypeWeak;
        case MonsterType28: return MonsterPropertyTypeWeak;
        case MonsterType39: return MonsterPropertyTypeImmune;
        case MonsterType40: return MonsterPropertyTypeImmune;
        case MonsterType41: return MonsterPropertyTypeImmune;
        case MonsterType42: return MonsterPropertyTypeImmune;
        case MonsterType43: return MonsterPropertyTypeImmune;
        case MonsterType44: return MonsterPropertyTypeImmune;
        case MonsterType45: return MonsterPropertyTypeImmune;
        case MonsterType51: return MonsterPropertyTypeImmune;
        case MonsterType61: return MonsterPropertyTypeImmune;
        case MonsterType69: return MonsterPropertyTypeImmune;
            
        default:
            return MonsterPropertyTypeNone;
    }
}

bool MonsterConfig::isCover(int type)
{
    switch (type) {
        case MonsterType46: return true;
        case MonsterType47: return true;
        case MonsterType48: return true;
        case MonsterType49: return true;
        case MonsterType50: return true;
        case MonsterType51: return true;
        case MonsterType52: return true;
        case MonsterType53: return true;
        case MonsterType54: return true;
        case MonsterType55: return true;
        case MonsterType56: return true;
        case MonsterType57: return true;
        case MonsterType58: return true;
        case MonsterType59: return true;
        case MonsterType60: return true;
        case MonsterType61: return true;
        case MonsterType62: return true;
        case MonsterType63: return true;
        case MonsterType64: return true;
        case MonsterType65: return true;
        case MonsterType66: return true;
        case MonsterType67: return true;
        case MonsterType68: return true;
        case MonsterType69: return true;
        case MonsterType70: return true;
        default:
            return false;
    }
}

const char* MonsterConfig::getBgName(int type)
{
    if(type <= MonsterType38){
        return "FightBg01.png";
    }else{
        return "FightBg02.png";
    }
}

